/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package caintra.Sapra.Pantalla.Empresa;

import caintra.Sapra.ComponentsImplements.BotonCaintra;
import caintra.Sapra.ComponentsImplements.LabelCaintra;
import caintra.Sapra.ComponentsImplements.SelectFieldCaintra;
import caintra.Sapra.ComponentsImplements.TextFieldCaintra;
import caintra.Sapra.ComponentsImplements.UploadCaintra;
import caintra.Sapra.ComponentsImplements.WindowCaintra;
import caintra.Sapra.Pantalla.Ajuste.Pantalla_Mensaje;
import caintra.Sapra.Pantalla.Direccion.DireccionView;
import nextapp.echo2.app.*;
import nextapp.echo2.app.filetransfer.UploadSelect;
import org.sapra.main.vPrincipal;

/**
 *
 * @author luiz
 */
public class EmpresaView extends ContentPane{
    
    public vPrincipal principal;
    public SelectFieldCaintra sel_lista_empresa,sel_esq_pago,sel_banco,sel_aseguradora,sel_gpo_empresa;
    public LabelCaintra lb_sel_empresa,lb_num_socio,lb_rfc,lb_raz_comercial,lb_raz_empresa,lb_gadm;
    public LabelCaintra lb_sel_lista,lb_sel_esq_pag,lb_sel_banco,lb_sel_aseguradora,lb_sel_gpo_empresa;
    public TextFieldCaintra txt_num_socio,txt_rfc,txt_raz_comercial,txt_raz_empresa,txt_gadm;
    public CheckBox chk_seg_pract,chk_fec_term_abierta,chk_notificacion,chk_suspendida;
    public Column col_supreme,col_empresa,col_info,col_boton,col_direccion;
    public  BotonCaintra nuevo,editar,guardar,ver;
    public WindowCaintra menu,message_window,calendarios_window;
    public UploadSelect cargar_archivo;
    public DireccionView direccion_view;
    
    public EmpresaView(vPrincipal principal){
        this.principal=principal;
        init_components();
        design_sheet();
        new EmpresaController(this);
    
    }
    public void init_components(){
        lb_sel_empresa=new LabelCaintra("Lista de Empresa ", Color.BLACK);
        lb_num_socio=new LabelCaintra("No. Socio  :", Color.BLACK);
        lb_rfc=new LabelCaintra("Rfc  :", Color.BLACK);
        lb_raz_comercial=new LabelCaintra("Razon Comercial  :", Color.BLACK);
        lb_raz_empresa=new LabelCaintra("Razon Empresa  :", Color.BLACK);
        lb_gadm=new LabelCaintra("Gasto Admon  :", Color.BLACK);
        lb_sel_lista=new LabelCaintra("Seleccion de Empresa  :", Color.BLACK);
        lb_sel_esq_pag=new LabelCaintra("Esquema de Pago  :", Color.BLACK);
        lb_sel_banco=new LabelCaintra("Banco  :", Color.BLACK);
        lb_sel_aseguradora=new LabelCaintra("Aseguradora  :", Color.BLACK);
        lb_sel_gpo_empresa=new LabelCaintra("Grupo de Empresa  :", Color.BLACK);
        
        sel_lista_empresa=new SelectFieldCaintra("sel_empresa", 250);
        sel_esq_pago=new SelectFieldCaintra("sel_esq_pago", 100);
        sel_banco=new SelectFieldCaintra("sel_banco", 100);
        sel_aseguradora=new SelectFieldCaintra("sel_aseguradora", 80);
        sel_gpo_empresa=new SelectFieldCaintra("sel_gpo_empresa", 300);
        
        chk_seg_pract=new CheckBox("Seguro de Practicante ");chk_seg_pract.setBorder(new Border(1, Color.BLACK, 2));
        chk_fec_term_abierta=new CheckBox("Fecha de Termino Abierta ");chk_fec_term_abierta.setBorder(new Border(1, Color.BLACK, 2));
        chk_notificacion=new CheckBox("Notificaciones");chk_notificacion.setBorder(new Border(1, Color.BLACK, 2));
        chk_suspendida=new CheckBox("Suspendida");chk_suspendida.setBorder(new Border(1, Color.BLACK, 2));
        
        txt_num_socio=new TextFieldCaintra(150, 20);txt_num_socio.setAlignment(Alignment.ALIGN_LEFT);txt_num_socio.setAlignment(Alignment.ALIGN_LEFT);
        txt_raz_comercial=new TextFieldCaintra(400, 80);txt_num_socio.setAlignment(Alignment.ALIGN_LEFT);txt_raz_comercial.setAlignment(Alignment.ALIGN_LEFT);
        txt_raz_empresa=new TextFieldCaintra(400, 80);txt_num_socio.setAlignment(Alignment.ALIGN_LEFT);txt_raz_empresa.setAlignment(Alignment.ALIGN_LEFT);
        txt_gadm=new TextFieldCaintra(50, 3);txt_num_socio.setAlignment(Alignment.ALIGN_LEFT);txt_gadm.setAlignment(Alignment.ALIGN_CENTER);
        txt_rfc=new TextFieldCaintra(150, 13);txt_num_socio.setAlignment(Alignment.ALIGN_LEFT);txt_rfc.setAlignment(Alignment.ALIGN_LEFT);
        
        nuevo =  new BotonCaintra("Nuevo.png", "nuevo");
        editar =  new BotonCaintra("Editar.png", "editar");
        guardar =  new BotonCaintra("guardar.png", "guardar");
        ver = new BotonCaintra("Ver Calendario", 150, "ver");
        
        cargar_archivo=new UploadSelect();
        cargar_archivo.setSendButtonDisplayed(true);
        cargar_archivo.setEnabledSendButtonText("Cargar Calendarios");
        menu= new WindowCaintra("Opciones de Empresa", 0, 0, 170, 150);
        menu.setVisible(true);
        menu.setModal(false);
        menu.setClosable(false);
        col_supreme=new Column();
        col_empresa=new Column();
        col_info=new Column();
        col_boton=new Column();
        direccion_view=new DireccionView();
        col_direccion = direccion_view.getColumn();
        if(col_direccion == null){
            col_direccion = new Column();
        }
        calendarios_window = new WindowCaintra("Calendarios de Facturacion", 20, 20, 600, 300);
        message_window=new WindowCaintra("Problema en Empresa", 80, 80, 350, 150);
        message_window.setContentMessage(new Pantalla_Mensaje());
        
    }
    
    public void design_sheet(){
        
        ContentPane menu_panel=new ContentPane();
        col_boton.add(nuevo);
        col_boton.add(editar);
        col_boton.add(guardar);
        menu_panel.add(col_boton);col_boton.setInsets(new Insets(10, 10, 0, 0));
        menu.add(menu_panel);
        
        
        Row row1=new Row();
        row1.add(lb_sel_empresa);
        row1.add(sel_lista_empresa);
        col_empresa.add(row1);
        
        //columna para los demas campos empresa
        
        Grid g_emp=new Grid(2);
        
        g_emp.add(lb_raz_comercial);
        g_emp.add(txt_raz_comercial);
        g_emp.add(lb_raz_empresa);
        g_emp.add(txt_raz_empresa);
        g_emp.setRowHeight(1, new Extent(30));
        g_emp.setRowHeight(2, new Extent(30));
        g_emp.setColumnWidth(0, new Extent(130));
        
        Grid g_emp2=new Grid(4);
        
        g_emp2.setColumnWidth(0, new Extent(80));
        g_emp2.setColumnWidth(1, new Extent(170));
        g_emp2.setColumnWidth(2, new Extent(100));
        g_emp2.add(lb_num_socio);
        g_emp2.add(txt_num_socio);g_emp2.setRowHeight(1, new Extent(30));
        g_emp2.add(lb_rfc);
        g_emp2.add(txt_rfc);
        
        g_emp2.add(lb_gadm);
        g_emp2.add(txt_gadm);
        g_emp2.add(lb_sel_esq_pag);
        g_emp2.add(sel_esq_pago);g_emp2.setRowHeight(2, new Extent(40));
        
        g_emp2.add(lb_sel_banco);
        g_emp2.add(sel_banco);
        g_emp2.add(lb_sel_aseguradora);
        g_emp2.add(sel_aseguradora);g_emp2.setRowHeight(3, new Extent(20));
        
        
        Grid g_emp3=new Grid(4);
        g_emp3.add(chk_seg_pract);g_emp3.setColumnWidth(0, new Extent(180));
        g_emp3.add(chk_fec_term_abierta);g_emp3.setColumnWidth(1, new Extent(250));
        g_emp3.add(chk_notificacion);g_emp3.setColumnWidth(2, new Extent(180));
        g_emp3.add(chk_suspendida);g_emp3.setColumnWidth(3, new Extent(180));
        g_emp3.setRowHeight(0, new Extent(30));
        
        Grid g_emp4=new Grid(2);
        
        g_emp4.add(lb_sel_gpo_empresa);g_emp4.setRowHeight(1, new Extent(30));
        g_emp4.add(sel_gpo_empresa);
        
        col_info.add(g_emp);
        col_info.add(g_emp2);
        col_info.add(g_emp3);
        col_info.add(g_emp4);
        col_info.add(cargar_archivo);
        col_info.add(ver);
        
        //fin columna para los campos empresa
        col_empresa.setInsets(new Insets(10, 0, 0, 0));
        col_info.setInsets(new Insets(10, 0, 0, 0));
        col_direccion.setInsets(new Insets(10, 0, 0, 0));
        col_supreme.add(col_empresa);
        col_supreme.add(col_info);
        col_supreme.add(col_direccion);
        col_supreme.setInsets(new Insets(190, 0, 0, 0));
        
        col_supreme.add(principal.getMenu());
        this.add(col_supreme);
        this.add(menu);
        
        
    }
    
}
